package com.youlai.system.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.system.common.model.Option;
import com.youlai.system.model.entity.SysPosition;
import com.youlai.system.model.form.PositionForm;
import com.youlai.system.model.vo.PositionPageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 岗位对象转换器
 */
@Mapper(componentModel = "spring")
public interface PositionConverter {
    Page<PositionPageVO> entity2Page(Page<SysPosition> page);

    SysPosition form2Entity(PositionForm positionForm);

    PositionForm entity2Form(SysPosition entity);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "name")
    })
    Option entity2Option(SysPosition position);


    List<Option> entities2Options(List<SysPosition> positions);
}
